import http from "../request.js";
const header = { "Content-Type": "application/x-www-form-urlencoded" };

class GoodsCenter {
  constructor() {
		this.collectList_Api =             "/api/hqshop/goods/collectList";               // 收藏列表
    this.collectGoodsApi =             "/api/hqshop/goods/collectGoods";              // 关注商品或收藏商品
    this.notcollectGoodsApi =          "/api/hqshop/goods/notcollectGoods";           // 取消关注商品或收藏商品
		this.goodsdetailApi =              "/api/hqshop/goods/detail";                    // 商品详情
		this.category_listApi =            "/api/hqshop/goods/category_list";             // 商品搜索
		
		this.getlistsApi =                 "/api/hqshop/cart/getlists";                   // 购物车列表
		this.addApi =                      "/api/hqshop/cart/add";                        // 加入购物车 加 1
		this.cartSubApi =                  "/api/hqshop/cart/sub";                        // 购物车数量减 1
		this.cartdeleteApi =               "/api/hqshop/cart/delete";        			        // 购物车删除接口
		
		this.goods_commentsApi =           "/api/hqshop/comments/goods_comments";         // 评论列表
		this.orderBuyNowApi =              "/api/hqshop/order/buyNow";                    // 单个商品立即购买
		this.cartBuyNowApi =              "/api/hqshop/order/cartBuyNow";                    // 商圈商品立即购买
		this.buyNow_payApi =               "/api/hqshop/order/buyNow_pay";                // 单个商品确认下单
		this.orderDetailApi =              "/api/hqshop/order/detail";                    // 订单详情
		this.yuepay_Api =                  "/api/hqshop/order/yuepay";                    // 余额支付
		this.cart_pay_Api =                "/api/hqshop/order/cart_pay";                  // 购物车提交订单
		this.buyer_huanjia_Api =           "/api/hqshop/order/buyer_huanjia";             // 买家发起还价接口(创建)
		
		this.dyjpay_Api =                  "/api/hqshop/order/dyjpay";                    // 抵用券
		
	
		
  }
	
	collectList(data) {
	  return http.post(this.collectList_Api,data,{header}).then((res) => res.data);
	}
  collectGoods(data) {
    return http.post(this.collectGoodsApi,data,{header}).then((res) => res.data);
  }
	notcollectGoods(data) {
	  return http.post(this.notcollectGoodsApi,data,{header}).then((res) => res.data);
	}
	goodsdetail(data) {
	  return http.post(this.goodsdetailApi,data,{header}).then((res) => res.data);
	}
	category_list(data) {
	  return http.post(this.category_listApi,data,{header}).then((res) => res.data);
	}
	merchIndex(data) {
	  return http.post(this.merchIndexApi,data,{header}).then((res) => res.data);
	}
	
	getlists(params) { // 购物车列表
	  return http.post(this.getlistsApi, params|| {}).then((res) => res.data);
	}
	addCart(params) { // 加入购物车 加 1
	  return http.post(this.addApi, params || {}).then((res) => res.data);
	}
	subCart(params) { // 购物车数量减 1
	  return http.post(this.cartSubApi, params || {}).then((res) => res.data);
	}
	deleteCart(params) { // 购物车删除接口
	  return http.post(this.cartdeleteApi, params || {}).then((res) => res.data);
	}
	
	goods_comments(data) {
	  return http.post(this.goods_commentsApi,data,{header}).then((res) => res.data);
	}
	
	orderBuyNow(data) {
	  return http.post(this.orderBuyNowApi,data,{header}).then((res) => res.data);
	}
	cartBuyNow(data) {
	  return http.post(this.cartBuyNowApi,data,{header}).then((res) => res.data);
	}
	buyNow_pay(data) {
	  return http.post(this.buyNow_payApi,data,{header}).then((res) => res.data);
	}
	orderDetail(params) { // 订单详情
	  return http.post(this.orderDetailApi, params || {}).then((res) => res.data);
	}
	yuepay(params) { // 余额支付
	  return http.post(this.yuepay_Api, params || {}).then((res) => res.data);
	}
	dyjpay(params) { // 抵用券支付
	  return http.post(this.dyjpay_Api, params || {}).then((res) => res.data);
	}
	cart_pay(params) { // 支付
	  return http.post(this.cart_pay_Api, params || {}).then((res) => res.data);
	}
	
	buyer_huanjia(params) { // 买家发起还价接口
	  return http.post(this.buyer_huanjia_Api, params || {}).then((res) => res.data);
	}
	
	
	

}

export const GoodsCenterApi = new GoodsCenter();
